package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
//OutputStream
public class IODemo10 {
    public static void main(String[] args) {
        try (OutputStream outputStream = new FileOutputStream("./text_new.txt",true)){
            outputStream.write(65);//清空重新写,但清空操作不是write引起的,而是打开文件引起的(OutputStream)
            //可以通过设置append参数为true进行追加写
            byte[] buffer = new byte[]{48,65,97};
            outputStream.write(buffer);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
